<template>
  <div id="box">

    <h3>添加</h3>
     <el-form :model="form" label-width="120px"
       style="max-width: 460px"
     >



            <el-form-item label="审核人姓名">
      <el-input v-model="form.reviewer_name"   class="input"   placeholder="请输入审核人姓名"   />
    </el-form-item>



        <el-form-item label="openid">
      <el-input v-model="form.openid"   class="input"   placeholder="请输入openid"    />
    </el-form-item>


          <el-form-item label="手机号">
      <el-input v-model="form.mobile"   class="input"   placeholder="请输入手机号"   />
    </el-form-item>


        <el-form-item label="部门">
   <el-cascader  :options="options" 
   
   :props="props"

   />
    </el-form-item>
    


      <el-form-item label="职务">
      <el-input v-model="form.job"  class="input"    placeholder="请输入部门名称"    />
    </el-form-item>


     <el-form-item label="是否启用">

            <el-switch v-model="form.is_use"
                       class="ml-2"
                       style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" />

          </el-form-item>


  
        

    

  <el-form-item>
        <el-button >取消</el-button>
         <el-button type="primary" @click="add">添加</el-button>

  </el-form-item>

   
     </el-form>


  </div>
</template>

<script lang="ts" setup>
import { reactive ,onMounted, ref} from 'vue'


import {departmentlist} from '../../api/chart/keyboard'
import {revieweradd} from '../../api/reviewer'

const form = reactive({
  reviewer_name:'',
  openid:'',
  mobile:'',

  job:' ',
  is_use:"1",
department:"保卫处"



})


const props = {
   value: 'name',
    label: 'name',
    children:"son"
}


const add=async()=>{
  console.log(form);
  const res=await revieweradd(form)
  console.log(res);
  
  
}


  let options = ref([]);

    const list=async()=>{
    console.log(6);
    const res:any = await departmentlist()
    console.log(res);
    options.value=res.data

      
    
  }

  onMounted(()=>{
      list()
  })

</script>

<style lang="less" scoped>
@import url("../../assets/css/reviewer/revieweradd.less");
</style>